package com.gitee.wsl.ext.list

fun <T> MutableList<T>.move(fromIndex: Int, toIndex: Int): MutableList<T> {
    add(toIndex, removeAt(fromIndex))
    return this
}

fun <T> MutableList<T>.moveOnTop(
    predicate: (T) -> Boolean
) {
    val (first, last) = partition(predicate)
    clear()
    addAll(first + last)
}